#define _CRT_SECURE_NO_WARNINGS
#include"array.h"

#define MAX(a,b) ((a) > (b) ? (a) : (b))
int cmp(const void* x, const void* y)
{
    return *(int*)x - *(int*)y;
}

int maximumProduct(int* nums, int numsSize)
{
    qsort(nums, numsSize, sizeof(int), cmp);
    return MAX(nums[0] * nums[1] * nums[numsSize - 1], nums[numsSize - 1] * nums[numsSize - 2] * nums[numsSize - 3]);
}